<template>
  <div class="baseimages_container">
      <div class="imgs_box" v-for="(item, key) in imgList" :key="key" @dblclick="handleDblclick(item)">
        <el-image 
          v-bind="$attrs" 
          class="image" 
          :src="inFilePrefix + item.picUrl" 
          :preview-src-list="previewSrcList" 
          lazy>
        </el-image>
        <div class="imgs_main">
          <div class="imgs_title">
            {{ item.title }}
          </div>
          <div class="imgs_edit" :class="item.editType === '一键撤防' ? 'isGarrison' : ''" v-if="item.editType" @click="handleClick(item)">
            <span class="eidt_cursor">
              {{ item.editType }}
            </span>
          </div>
        </div>
        <div class="imgs_footer"></div>
      </div>
    

  </div>
</template>

<script>
import { mapState } from 'vuex'
import Empty from '@/components/Empty'
export default {
  name: 'baseimage',
  props: {
    imgList: {
      type: Array,
      default: () => [],
    },
    filedValue: {}
  },
  created () {
    console.log(this.previewSrcList)
  },
  computed: {
    previewSrcList() {
      return this.imgList.map(item => this.inFilePrefix + item.picUrl)
    },
    ...mapState('config', ['inFilePrefix'])
  },
  watch: {
  },
  methods: {
    handleClick (imagedata) {
      this.$emit('click', imagedata)
    },
    handleDblclick (item) {
      console.log(item)
      this.$emit('handleDblclick', item)
    },
  },
  components: {
    Empty
  }
}
</script>

<style lang="less" scoped>
.baseimages_container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: center;
  margin-bottom: 15px;
  min-height: 200px;
  .imgs_box {
    width: 275px;
    height: 174px;
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: rgba(48, 158, 255, 0.2);
    // border: 1px solid #309eff;
    border: 1px solid rgba(48, 158, 255, 0.2);

    padding: 12px;
    &::after {
      position: absolute;
      top: 3px;
      left: 3px;
      content: "";
      border-top: 5px solid rgba(48, 158, 255, 0.7);
      border-right: 5px solid transparent;
      border-bottom: 5px solid transparent;
    }
    &::before {
      position: absolute;
      top: 3px;
      right: 3px;
      content: "";
      border-top: 5px solid rgba(48, 158, 255, 0.7);
      border-left: 5px solid transparent;
      border-bottom: 5px solid transparent;
    }
    .image {
      width: 100% !important;
      height: 100% !important;
    }
    .imgs_main {
      display: flex;
      justify-content: space-between;
      padding-top: 5px;
      .imgs_title {
        font-weight: 400;
        font-size: 14px;
        color: #ffffff;
      }
      .imgs_edit {
        font-weight: 400;
        font-size: 14px;
        color: #309eff;
        cursor: pointer;
      }
      .isGarrison {
        color: rgba(255, 56, 56, 1);
      }
    }
    .imgs_footer {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      &::after {
        position: absolute;
        top: -13px;
        left: 3px;
        content: "";
        border-top: 5px solid transparent;
        border-right: 5px solid transparent;
        border-bottom: 5px solid rgba(48, 158, 255, 0.7);
      }
      &::before {
        position: absolute;
        top: -13px;
        right: 3px;
        content: "";
        border-top: 5px solid transparent;
        border-left: 5px solid transparent;
        border-bottom: 5px solid rgba(48, 158, 255, 0.7);
      }
    }
  }
}
</style>
